# SConscript

import os
Import('aEnv')

incboost = aEnv['boost_inc']
aEnv.Library(target = 'unittest', source = ['unittest.cpp'], CPPPATH=['../include', '../third_party'])

UTlib = ['unittest', 'mcompiler', 'compiler', 'ga', 'syntax', 'stacktrace', 'typename', 'regex', aEnv['regexlib'], 'fs']
UTinc = ['../include', '../makecompiler', '../compiler', '../syntax', '../galgorithm', './', '../third_party', incboost]
UTlibpath = ['.', '../mcompiler', '../compiler', '../syntax', '../galgorithm', '../third_party/stacktrace', '../third_party/typename', '../third_party/regexlib', '../third_party/fslib']

if int(ARGUMENTS.get('parseg', 0)):
    cppfiles = ['syntaxgeneratortest.cpp']
    aEnv.Program(target = 'parsesyntax', source = cppfiles, LIBS = UTlib + aEnv['regexlib'], CPPPATH=UTinc, LIBPATH=UTlibpath + [aEnv['boost_libpath']])

if int(ARGUMENTS.get('tinyg', 0)):
    #gfile = 'output/tinyg/tinyg.cpp'
    gfiles = ['tinyg.cpp', 'tinygprodfuncs.cpp']
    aEnv.Program(target= 'tinycompiler', source = ['tinygrammar-compiler.cpp'] + gfiles, LIBS=UTlib, CPPPATH=UTinc, LIBPATH=UTlibpath)

if int(ARGUMENTS.get('basictest', 0)):
	aEnv.Program(target= 'callstack', source = ['callstacktest.cpp'], LIBS=UTlib, CPPPATH=UTinc, LIBPATH=UTlibpath)

	aEnv.Program(target= 'docsplit', source = ['splitwords.cpp', 'usefullmachines.cpp'], LIBS=UTlib, CPPPATH=UTinc, LIBPATH=UTlibpath)

	aEnv.Program(target= 'gensyntax', source = ['tinygrammartest.cpp'], LIBS=UTlib, CPPPATH=UTinc, LIBPATH=UTlibpath)

	aEnv.Program(target= 'regex2nfa', source = ['regexnfatest.cpp'], LIBS=UTlib, CPPPATH=UTinc, LIBPATH=UTlibpath)

	aEnv.Program(target= 'basicga', source = ['basicalgorithmtest.cpp'], LIBS=UTlib, CPPPATH=UTinc, LIBPATH=UTlibpath)

	aEnv.Program(target= 'firstfollow', source = ['firstfollowtest.cpp'], LIBS=UTlib, CPPPATH=UTinc, LIBPATH=UTlibpath)

	aEnv.Program(target= 'nfa2dfa', source = ['nfa2dfatest.cpp'], LIBS=UTlib, CPPPATH=UTinc, LIBPATH=UTlibpath)

	aEnv.Program(target= 'lrmachine', source = ['lrmachinetest.cpp'], LIBS=UTlib, CPPPATH=UTinc, LIBPATH=UTlibpath)

